//
//  SCGoodsDetailCommentCell.m
//  shangcheng
//
//  Created by 张艳江 on 2019/6/17.
//  Copyright © 2019 张艳江. All rights reserved.
//

#import "SCGoodsDetailCommentCell.h"
#import "SCDetailCommentCell.h"

@implementation SCGoodsDetailCommentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc]init];
    layout.minimumLineSpacing = 8;
    layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;//滚动方向
    layout.itemSize = CGSizeMake(230, 96);
    layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10);
    
    self.collectionView.collectionViewLayout = layout;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    self.collectionView.showsVerticalScrollIndicator = NO;
    self.collectionView.showsHorizontalScrollIndicator = NO;
    
    //定义xib文件
    [self.collectionView registerNib:[UINib nibWithNibName:@"SCDetailCommentCell" bundle:nil] forCellWithReuseIdentifier:@"SCDetailCommentCellID"];
}
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    return self.commentArray.count;
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    SCDetailCommentCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"SCDetailCommentCellID" forIndexPath:indexPath];
    cell.model = self.commentArray[indexPath.row];
    return cell;
}
- (void)setCommentArray:(NSArray *)commentArray{
    _commentArray = commentArray;
    [self.collectionView reloadData];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
